<!DOCTYPE html>
<html>
    <head>
        <base target="_self">
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0 , maximum-scale=1.0, user-scalable=0">
        <title>[测试投票]性感美女</title>
        <meta name="format-detection" content="telephone=no"/>
        <meta name="apple-mobile-web-app-capable" content="yes"/>
        <meta name="apple-mobile-web-app-status-bar-style" content="black"/>
        <link href="style/touch.css" rel="stylesheet" type="text/css"/>
        <script src="style/jquery.js" type="text/javascript"></script>
        <script src="style/jquery.grid-a-licious.min.js" type="text/javascript"></script>
        <script src="style/common.js" type="text/javascript"></script>
    </head>
    <body>
        <section class="top_box clearfix">
            <img src="style/common_469_pEILDPkE.jpg" />
        </section>
        <section class="tongji_box clearfix">
            <ul class="clearfix">
                <li>
                    <p>参与选手</p>
                    <p>522</p>
                    <span></span>
                </li>
                <li>
                    <p>累计投票</p>
                    <p>4057</p>
                    <span></span>
                </li>
                <li>
                    <p>访问量</p>
                    <p>98650</p>
                </li>
            </ul>
        </section>
        <section class="index_nav clearfix">
            <div class="index_nav_btns clearfix">
                <a href="ranking.html">排行榜</a>
                <a href="#prize">奖项设置</a>
                <a href="applay.html">我要报名</a>
            </div>
        </section>
        <section class="index_search_box clearfix">
            <div class="index_search_box_main clearfix">
                <div class="form_box">
                    <form action="" id="search_form2" method="post" onsubmit="return false;">
                        <table width="100%">
                            <tr>
                                <td width="">
                                    <input class="input_class"
                                           style="border: 1px solid #09ACDB;"
                                           type="text" id="keywords" name="keywords"
                                           placeholder="输入编号或者名称搜索"/>
                                </td>
                                <td width="70">
                                    <input name="dosubmit" class="a_class id_search_btn2" style="background-color: #09ACDB;" type="button" value="搜索">
                                </td>
                            </tr>
                        </table>
                    </form>
                    <script>
                        $(".id_search_btn2").click(function() {
                            var key = $("#keywords").val();
                            if (key > 0) {
                                getData(1, key);
                            } else {
                                alert("输入编号或者名称搜索");
                            }
                        });
                    </script>
                </div>
            </div>
        </section>
        <section class="title_box clearfix">
            <div class="title_box_main clearfix">
                <span>[测试投票]性感美女</span>
            </div>
        </section>
        <section class="time_box clearfix">
            <div class="time_box_main clearfix">
                <span>2015-01-26 至 2018-01-31</span>
            </div>
        </section>
        <!-- list -->
        <section class="list_box clearfix" id="result">
            <div id="list_box"></div>
            <div class="pages clearfix" >
                <ul class="clearfix" id="pagecount">

                </ul>
            </div>
            <script type="text/javascript">
                var curPage = 1; //当前页码
                var total = 0, pageSize = 10, totalPage = 0; //总记录数，每页显示数，总页数
                //获取数据
                function getData(page, keywords) {
                    $.ajax({
                        type: 'GET',
                        url: 'ajax.php?action=search',
                        data: {'pageNum': page - 1, 'keywords': keywords},
                        dataType: 'json',
                        beforeSend: function() {
                            $("#list_box").append("<div id='loading'>loading...</div>"); //显示加载动画
                        },
                        success: function(json) {
                            $("#list_box").empty(); //清空数据区
                            total = json.total; //总记录数
                            pageSize = json.pageSize; //每页显示条数
                            curPage = page; //当前页
                            totalPage = json.totalPage; //总页数
                            var list = json.list;
                            $.each(list, function(index, array) { //遍历json数据列
                                var id = array.id;
                                var name = array.name;
                                var vote = array.vote;
                                var photo = array.photo;
                                var html = "<div class='list_item'><a href='#'><img src='data/" + photo + "' width='170' />"
                                        + "<div class ='title'><span class = 'xs'> 选手： </span>" + name + "</div>"
                                        + "<div class ='msg_box'><span class ='bianhao'> " + id + "号 </span><span class = 'num'> <i id='vote_" + id + "'>" + vote + "</i>票 </span></div>"
                                        + "<div class ='btn_box'><span class ='btn' onclick='vote(" + id + ")' style ='background - color: #09ACDB; '> 投票 </span>"
                                        + "</div></a></div>";
                                $("#list_box").append(html);
                            });
                            $("#list_box").gridalicious({
                                gutter: 5,
                                width: 160,
                                animate: true,
                                animationOptions: {
                                    speed: 150,
                                    duration: 400,
                                    complete: onComplete
                                }
                            });
                            function onComplete(data) {
                            }
                        },
                        complete: function(XMLHttpRequest, textStatus) {//生成分页条
                            getPageBar();
                        }
                        /*
                         ,error: function(XMLHttpRequest, textStatus, errorThrown) {
                         alert("数据加载失败");
                         alert(XMLHttpRequest.status);//200
                         alert(XMLHttpRequest.readyState);//4
                         alert(textStatus);
                         }*/
                    });
                }
                //获取分页条
                function getPageBar() {
                    //页码大于最大页数
                    if (curPage > totalPage)
                        curPage = totalPage;
                    //页码小于1
                    if (curPage < 1)
                        curPage = 1;
                    pageStr = "";
                    //如果是第一页
                    if (curPage == 1) {
                        pageStr += "<li style='width: 30%;'><span>首页</span></li>";
                    } else {
                        pageStr += "<li style='width: 30%;'><a href='javascript:void(0)' rel='" + (curPage - 1) + "' > 上一页 </a></li>";
                    }
                    pageStr += "<li style='width: 40%;'><span>" + curPage + "/" + totalPage + "</span></li>";
                    //如果是最后页
                    if (curPage >= totalPage) {
                        pageStr += "<li style='width: 30%;'><span>尾页</span></li>";
                    } else {
                        pageStr += "<li style='width: 30%;'><a href='javascript:void(0)' rel='" + (parseInt(curPage) + 1) + "'>下一页 </a></li>";
                    }
                    $("#pagecount").html(pageStr);
                    $("#pagecount li a").on('click', function() {
                        var rel = $(this).attr("rel");
                        if (rel) {
                            getData(rel, "");
                        }
                    });
                }
                function vote(id) {
                    var timestamp = (new Date).getTime();/*当前时间戳*/
                    $.ajax({
                        type: "POST",
                        url: "ajax.php?action=vote",
                        data: {'id': id, 'timestamp': timestamp},
                        success: function(data) {
                            if (data == '') {
                                loading(false);
                                tusi('投票失败,稍后重试');
                            }
                            var dataarr = data.split('|');
                            if (dataarr[0] == '1') {
                                var tstamp = dataarr[1];
                                var iv = $("#vote_" + id).html();
                                var nvalue = parseInt(iv) + 1;
                                $("#vote_" + id).html(nvalue);
                            }
                        }
                    });
                }

            </script>
        </section>
        <!-- list end -->
        <section class="common_title clearfix" id="prize">
            <div class="common_title_main clearfix" style="background-color: #09ACDB;">
                <span>奖项设置</span>
            </div>
        </section>
        <section class="content_box clearfix">
            <div class="content_box_main clearfix">
                1、投票前3名奖品设置<br/>

                一等奖 1名 苹果手机IPhone6S+ 1888现金奖励；<br/>
                二等奖 1名 苹果平板Ipad pro+888现金奖励；<br/>
                三等奖 1名 苹果手表Iwatch+666现金奖励；<br/>
                投票第4名至第10名 666元现金<br/>
                投票前10名均到房网总部领取奖品和证书。<br/>

                2、投票超过100者，获得南昌恒大城大礼包一份<br/>
                （不包含投票前10名，5月9日之后全城快递，限量100份，以南昌房网公众号回复为准，先到先得）。 <br/>
            </div>
        </section>
        <section class="common_title clearfix">
            <div class="common_title_main clearfix" style="background-color: #09ACDB;">
                <span>参赛须知</span>
            </div>
        </section>
        <section class="content_box clearfix">
            <div class="content_box_main clearfix">
                关注老罗微信公众平台，填写相关信息及上传照片。<br/>
                可以在两个微信平台每天各投一票（即每天可投两票）。<br/>
                特别注意！两个号各有一票，千万别忽略咯！投票后取消关注的，投票无效！<br/>
                <span style="color:#F00; text-align:center">严禁刷票，发现一律拉进黑名单永不参与本次活动！</span>
            </div>
        </section>
        <section class="common_title clearfix">
            <div class="common_title_main clearfix" style="background-color: #09ACDB;">
                <span>参与对象</span>
            </div>
        </section>
        <section class="shop_item clearfix">
            <div class="shop_item_main clearfix">
                <p>
                    够美，够帅，够萌，够Big，够拼，够自信...的你！
                </p>
            </div>
        </section>
        <section class="common_title clearfix">
            <div class="common_title_main clearfix" style="background-color: #09ACDB;">
                <span>投票方式</span>
            </div>
        </section>
        <section class="shop_item clearfix">
            <div class="shop_item_main clearfix">
                1、打开老罗微信公众号活动页面；<br>
                2、或者回复投票；<br>
                <img src="style/ewm.jpg" style="width:40%; float:left; margin-right:20px">
            </div>
        </section>
        <section class="common_title clearfix">
            <div class="common_title_main clearfix" style="background-color: #09ACDB;">
                <span>客服须知</span>
            </div>
        </section>
        <section class="shop_item clearfix">
            <div class="shop_item_main clearfix">
                活动期间遇到任何问题都可以联系我们的客服（微信号：luomingui）或<br>
                （电话:18682496331）反映问题。<br>
            </div>
        </section>
        <!-- footer start-->
        <section class="footer_block clearfix "></section>
        <footer class="footer_main clearfix">
            <link rel="stylesheet" type="text/css" href="style/daohang.css">
            <div class="bot_main">
                <ul>
                    <li class="ico_1"><a href="index.html"><span class="ico"><img src="style/i1.png" /></span><span class="txt">首页</span></a></li>
                    <li class="ico_3"><a href="applay.html"><span class="ico"><img src="style/i2.png" /></span><span class="txt">报名</span></a></li>
                    <li class="ico_2"><a href="ranking.html"><span class="ico"><img src="style/i3.png" /></span><span class="txt">排名</span></a></li>
                    <li class="ico_4"><a href="http://mp.weixin.qq.com/s?__biz=MzAxNzUzMjA3NA==&tempkey=9QqH4VjlxGVBDx09OjjMT%2FkXPl6902NysC3KFsKWhZ%2FhZmbtUjPOVqq5ieLEOzgf%2BvFJyv7MaUqu%2BH%2BhcO6GCIBCk0pcmwqGu3TW%2FiDdzvCoQOjUDmRSRSxJTXMhTQvJbegNVNswu7BFQ626t3GkJQ%3D%3D&#rd"><span class="ico"><img src="style/i4.png" /></span><span class="txt">自定义</span></a></li>
                </ul>
            </div>

        </footer>
        <!-- footer end-->
        <script type="text/javascript">
            $(document).ready(function() {
                getData(1, "");

            });
            $(".footer_nav_search").on("click", function(event) {
                $(window).scrollTop(0);
                $(".search_box").removeClass('box_hide');
            });
            $(".search_close_box").on("click", function(event) {
                $(".search_box").addClass('box_hide');
            });
            var contentOpen = 0;
            $(".content_title").on("click", function(event) {
                if (contentOpen == 1) {
                    contentOpen = 0;
                    $(".content_box").addClass('box_hide');
                } else {
                    contentOpen = 1;
                    $(".content_box").removeClass('box_hide');
                }
            });
        </script>
    </body>
</html>

